
package ch.hearc.coursJava.kitBase.de.wrapperPerso;

/**
 *<pre>
 *Problematique des egalites:
 *Observation: elle peut etre basee sur 4 strategies differentes:
 * 	reference
 * 	equals(Object)
 * 	hashCode(Object)
 * 	comparTo(Comparable)
 *
 *Hashxxx: egalite basee sur hashCode
 *Treexxx: egalite basee sur comparTo
 *xxx = Map, Set
 *
 *Comtrainte: si la methode HashCode est implementee elle doit respecter la regle suivante:
 *a.hashCode == b.hashCode ssi a.equals(b) == true
 *</pre>
 */
public class Integers extends Object implements Comparable<Integers>
	{

	/*------------------------------------------------------------------*\
	|*							Constructeurs							*|
	\*------------------------------------------------------------------*/

	public Integers(int valeur)
		{
		this.valeur = valeur;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Public							*|
	\*------------------------------------------------------------------*/

	@Override
	public int compareTo(Integers integer2)
		{
		return (new Integer(this.valeur)).compareTo(new Integer(integer2.valeur));
		}

	@Override
	public int hashCode()
		{
		return valeur;
		}

	@Override
	public boolean equals(Object obj)
		{
		if (obj instanceof Integers)
			{
			Integers integers = (Integers)obj;
			return valeur == integers.valeur;
			}
		else
			{
			return false;
			}

		}

	@Override
	public String toString()
		{
		StringBuilder builder = new StringBuilder();
		builder.append("Integers [valeur=");
		builder.append(this.valeur);
		builder.append("]");
		return builder.toString();
		}

	/*------------------------------*\
	|*				Set				*|
	\*------------------------------*/

	public void setValeur(int valeur)
		{
		this.valeur = valeur;
		}

	/*------------------------------*\
	|*				Get				*|
	\*------------------------------*/

	public int getValeur()
		{
		return this.valeur;
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	/*------------------------------------------------------------------*\
	|*							Attributs Private						*|
	\*------------------------------------------------------------------*/

	//Inputs/Outputs
	private int valeur;

	}
